package com.haruhinav.controller;

import com.haruhinav.Utils.TimeTool;
import com.haruhinav.entity.Hitoko;
import com.haruhinav.entity.vo.ResultVO;
import org.springframework.web.bind.annotation.*;
import com.haruhinav.Utils.Translate;

import javax.annotation.Resource;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;


@RestController
@RequestMapping("/api/tool")
public class ToolController {

   // private Translate translate = new Translate();

    @Resource
    private Translate translate;
    @Resource
    private TimeTool timeTool;

    @RequestMapping(value = "/a/translate",method = RequestMethod.GET)
    public Object googleTrans(@RequestParam("msg") String msg){

        return translate.RequestGoogleTrans(msg);
    }
//    获取北京标准日期
    @RequestMapping("/e/getWebsiteDatetime")
    public ResultVO getWebsiteDatetime() {
        ResultVO result = new ResultVO();
        try {
            result.setData(timeTool.GetWebsiteDatetime());
            result.setCode(0);
            return result;
        }catch (Exception e){
            result.setCode(-1);
        }

        return result;
    }



}
